<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 
*/
class Revenue extends MY_Controller
{
	
	public function __construct()
	{
		parent::__construct();
		
		$this->load->model('Statis/RevenueModel','revenue');
	}


	public function index()
	{
		$data = $this->revenue->income_count();

		$this->load->view('revenue_list',$data);
	}


	//
	public function get_income()
	{
		$date_num = $this->input->get('date_num');

		$res = $this->revenue->income_data($date_num);

		if ($res) 
		{
			$data = $res;
			$data['status'] = 200;
			$data['message'] = '获取成功！';
		}
		else
		{
			$data['list'] = '';
			$data['status'] = 400;
			$data['message'] = '数据获取失败！';
		}

		echo json_encode($data);exit();

	}


	//
	public function card_record()
	{
		$dates = $this->input->get('sdate');
		$keyword = $this->input->get('keyword');
		$page = $this->input->get('page');
		$page = $page ? $page : 1;

		$res = $this->revenue->user_card_log($dates,$keyword,$page);

		if ($res) 
		{
			$data = $res;
			$data['status'] = 200;
			$data['message'] = '获取成功！';
		}
		else
		{
			$data['list'] = '';
			$data['status'] = 400;
			$data['message'] = '数据获取失败！';
		}

		echo json_encode($data);exit();


	}



}

?>